package com.ecut.property_project.service.impl;

import com.ecut.property_project.mapper.character.UserMapper;
import com.ecut.property_project.model.character.Role;
import com.ecut.property_project.model.character.User;
import com.ecut.property_project.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserById(Integer id) {

        return userMapper.findUserById(id);
    }

    public User findUserByWechat(String wechatId){
        return userMapper.findUserByWechat(wechatId);
    }


    @Override
    public Map<String, String> getUser() {
        return null;
    }

    @Override
    public List<Role> getUserRolesById(Integer id) {
        return userMapper.getUserRolesById(id);
    }

    @Override
    public User findUserByTel(String tel) {
        return userMapper.findUserByTel(tel);
    }

    @Override
    public List<User> selectAll() {
        return userMapper.selectAll();
    }

    @Override
    public List<User> selectByPage(Integer page, Integer pageSize) { return userMapper.selectByPage(page,pageSize);}

    @Override
    public List<User> findAllUser() {
        return userMapper.findAllUser();
    }

    @Override
    public Boolean updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public Boolean updateUserImage(String imageUrl, int id){
        return userMapper.updateUserImage(imageUrl, id);
    }
    @Override
    public Boolean updateUserWx(String WeChatId, int id){
        return userMapper.updateUserWx(WeChatId,id);
    }
    @Override
    public Boolean updateUserEmail(String email, int id){
        return userMapper.updateUserEmail(email,id);
    }
    @Override
    public Boolean updateUserTel(String tel, int id){
        return userMapper.updateUserTel(tel,id);
    }

    @Override
    public Boolean deleteUser(Integer id) {
        return userMapper.deleteUser(id);
    }

    @Override
    public Boolean saveList(List<User> list) {
        return userMapper.saveList(list);
    }

}
